/**
 * logistics-platform
 *
 * @author yuanchen
 * @date 2021-10-29 16:06
 */
package store.algorithm.impl;

import store.Item;
import store.algorithm.AbstarctItemChangeValueAlgorithm;

/**
 *
 * @author yuanchen
 * @date 2021-10-29 16:06
 */
public class ShowTicketItemChangeValueAlgorithm extends AbstarctItemChangeValueAlgorithm {

    private static final int SELL_IN_STAGE_1=10;

    private static final int SELL_IN_STAGE_2=5;

    private static final int SELL_IN_STAGE_3=0;

    /**
     * 演出票（Show Ticket）越接近演出日，价值反而上升。
     * 在演出前10天，价值每天上升2点；演出前5天，
     * 价值每天上升3点。但一旦过了演出日，价值就马上变成0
     * @param item
     */
    @Override
    public void changeCurrent(Item item) {
        item.sellIn=item.sellIn-SELL_IN_STEP;
        item.value=item.value+VALUE_STEP;
        if(item.sellIn<SELL_IN_STAGE_1){
            item.value=item.value+VALUE_STEP;
        }
        if(item.sellIn<SELL_IN_STAGE_2){
            item.value=item.value+VALUE_STEP;
        }
        if(item.sellIn<SELL_IN_STAGE_3){
            item.value= MIN_VALUE;
        }
    }
}
